home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / t_os / gpen32k / source.exe / LIB / OSRC / F12D.C < prev    next >
C/C++ Source or Header  |  1993-08-04  |  1KB  |  66 lines

  1. /*
  2.     拡張ライブラリIの12ドットフォントの利用
  3.                                         作・おこめ
  4.  
  5.     参考文献 : Oh! FM TOWNS 春の特別号(1993-3)
  6. */
  7.  
  8. #include    <EGB.H>
  9. #include    <FNT.H>
  10. #include    <sidework.h>
  11. #include    <Normlib.h>
  12.  
  13. #define    iskanji(c)    ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xfc))
  14.  
  15. unsigned short mma_allocSeg(char *para);
  16. void mma_freeSeg(unsigned short seg);
  17.  
  18. extern char work[];
  19.  
  20. void font12(int x, int y, char *n, int c)
  21. {
  22.     char pa[64];
  23.     unsigned short fseg;
  24.     unsigned int adr, i, h, l;
  25.     y-=11;
  26.     fseg = mma_allocSeg("FONT");
  27.     EGB_color( work, 0, c);
  28.     while(*n != 0)
  29.     {
  30.         if (iskanji(*n))
  31.         {
  32.             i = FNT_sjisToJis((*n << 8) + *(n+1));
  33.             if (i > 0x4fff)
  34.             {
  35.                 WORD(pa)=WORD(n);
  36.                 pa[2]=0;
  37.                 symbol(x,y+11, pa, 12, c);
  38.                 x+=12;
  39.                 i = 0;
  40.             }    else    {
  41.                 h = i >> 8;
  42.                 l = i & 0xff;
  43.                 adr = ((h-0x21)*94+l-0x21)*24+0xC00;
  44.                 i = 11;
  45.             }
  46.             n+=2;
  47.         }    else    {
  48.             adr = *n * 12;
  49.             n++;
  50.             i = 5;
  51.         }
  52.         if (i!=0)
  53.         {
  54.             DWORD(pa) = (int)adr;
  55.             WORD(pa+4) = fseg;
  56.             WORD(pa+6) = x;
  57.             WORD(pa+8) = y;
  58.             WORD(pa+10) = x+i;
  59.             WORD(pa+12) = y+11;
  60.             EGB_putBlockColor(work, 0, pa);
  61.             x+= i+1;
  62.         }
  63.     }
  64.     mma_freeSeg(fseg);
  65. }
  66.